package top.so.dao.impl;

import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import top.so.dao.AbstractBaseDao;
import top.so.dao.ColumnArticleDao;
import top.so.entity.ColumnArticle;

import java.util.List;
@Repository
public class ColumnArticleDaoImpl extends AbstractBaseDao implements ColumnArticleDao {
    public List<ColumnArticle> selectWithPage(ColumnArticle columnArticle, int pageNum) {
        PageHelper.startPage(pageNum,6);
        return this.getSqlSession().selectList(this.getClass().getName()+".select",columnArticle);
    }

    public boolean insertColumnArticle(ColumnArticle columnArticle) {
        if(this.getSqlSession().insert(this.getClass().getName()+".insert",columnArticle)==1){
            return true;
        }
        return false;
    }

    public boolean deleteColumnArticle(ColumnArticle columnArticle) {
        if(this.getSqlSession().delete(this.getClass().getName()+".delete",columnArticle)==1){
            return true;
        }
        return false;
    }

    public boolean updateColumnArticle(ColumnArticle columnArticle) {
        if(this.getSqlSession().update(this.getClass().getName()+".update",columnArticle)==1){
            return true;
        }
        return false;
    }
}
